package jtk.project4.fleet.field;

/*
* Author : Rio Dermawan 
* Date Created : 1-April-2011
* Date Modified : 6-April-2011
* Version : 1.5
* */

import java.awt.Dimension;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.CalendarControl;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.SpinnerField;
import nl.coderight.jazz.form.field.TextField;

public class AddFluidConsumedField extends GroupControl {
	private TextField EquipmentField;
	private CalendarControl DateField;
	private TextField MileageField;
	private ComboField<String> FluidField;
	private TextField PartField;
	private ComboField<String> WarehouseField;
	private SpinnerField<Integer> QuantityUsedField;
	private TextField UnitCostField;
	private ComboField<String> EmptyField;
	private TextField ExtendedCostField;
	private ComboField<String> CostCenterField;
	private TextField NotesField;
	
	
	public AddFluidConsumedField(String bindID){
		setTitle("header.AddFluidConsumed"); //disesuaikan dengan nama field
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields()
	{
		Dimension dimension = new Dimension(166, 20);
		EquipmentField = new TextField("EquipmentField", 20);
		
		DateField = new CalendarControl("date", 20);
		DateField.setPreferredSize(dimension);
		
		MileageField = new TextField("MileageField", 20);
		
		FluidField = new ComboField("FluidField", "");
		FluidField.setPreferredSize(dimension);
		
		PartField = new TextField("partId", 20);
		
		WarehouseField = new ComboField("warehouseId", "");
		WarehouseField.setPreferredSize(dimension);
		
		QuantityUsedField = new SpinnerField<Integer>("qty", "");
		QuantityUsedField.setPreferredSize(dimension);
		
		UnitCostField = new TextField("unitCost", 20);
		UnitCostField.setPreferredSize(dimension);
		
		EmptyField = new ComboField("EmptyField", "");
		EmptyField.setPreferredSize(dimension);
		
		ExtendedCostField = new TextField("ExtendedCostField", 20);
		
		CostCenterField = new ComboField("costCenter", "");
		CostCenterField.setPreferredSize(dimension);
		
		NotesField = new TextField("notes", 20);
		
			
	}
	
	private void createLayout()
	{
		setLayout(new FormLayout())

		.addLabel("label.Equipment :")	  .addField(EquipmentField)
		.addRow()
		.addLabel("label.Date :")		  .addField(DateField)
		.addRow()
		.addLabel("label.Mileage :")	  .addField(MileageField)
		.addRow()
		.addLabel("label.Fluid :") 		  .addField(FluidField)
		.addRow()
		.addLabel("label.Part :") 		  .addField(PartField)
		.addLabel("label.Warehouse :") 	  .addField(WarehouseField)
		.addRow()
		.addLabel("label.Quantity Used :").addField(QuantityUsedField)
		.addRow()
		.addLabel("label.Unit Cost :") 	  .addField(UnitCostField)
		.addField(EmptyField)
		.addRow()
		.addLabel("label.Extended Cost :").addField(ExtendedCostField)
		.addRow()
		.addLabel("label.Cost Center :") 	 .addField(CostCenterField)
		.addRow()
		.addLabel("label.Notes :") 	 .addField(NotesField)
		.addRow();
	}
}
